Skip to content

blk-wbt: Fix io starvation in wbt_rqw_done()#82

Closed
blktests-ci[bot] wants to merge 1 commit intolinus-master_basefrom
series/987357=>linus-master
Closed

blk-wbt: Fix io starvation in wbt_rqw_done()#82
blktests-ci[bot] wants to merge 1 commit intolinus-master_basefrom
series/987357=>linus-master

Conversation

@blktests-ci
Copy link
Copy Markdown

@blktests-ci blktests-ci Bot commented Jul 31, 2025

Pull request for series with
subject: blk-wbt: Fix io starvation in wbt_rqw_done()
version: 1
url: https://patchwork.kernel.org/project/linux-block/list/?series=987357

@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci Bot commented Jul 31, 2025

Upstream branch: 260f6f4
series: https://patchwork.kernel.org/project/linux-block/list/?series=987357
version: 1

@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci Bot commented Jul 31, 2025

Upstream branch: d6084bb
series: https://patchwork.kernel.org/project/linux-block/list/?series=987357
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/987357=>linus-master branch from ccc6583 to f98f6c9 Compare July 31, 2025 18:04
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from 0b59764 to aee5bd3 Compare July 31, 2025 19:11
@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci Bot commented Jul 31, 2025

Upstream branch: 831462f
series: https://patchwork.kernel.org/project/linux-block/list/?series=987357
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/987357=>linus-master branch from f98f6c9 to ae3d48a Compare July 31, 2025 19:18
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from aee5bd3 to ef18525 Compare July 31, 2025 20:07
@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci Bot commented Jul 31, 2025

Upstream branch: c93529a
series: https://patchwork.kernel.org/project/linux-block/list/?series=987357
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/987357=>linus-master branch from ae3d48a to 74b1e68 Compare July 31, 2025 20:13
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from ef18525 to 3851b3f Compare July 31, 2025 20:55
@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci Bot commented Jul 31, 2025

Upstream branch: cbbf0a7
series: https://patchwork.kernel.org/project/linux-block/list/?series=987357
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/987357=>linus-master branch from 74b1e68 to e66cc5c Compare July 31, 2025 21:01
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from 3851b3f to 28b3384 Compare July 31, 2025 23:42
@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci Bot commented Jul 31, 2025

Upstream branch: 6a68cec
series: https://patchwork.kernel.org/project/linux-block/list/?series=987357
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/987357=>linus-master branch from e66cc5c to c42ed1c Compare July 31, 2025 23:48
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from 28b3384 to 8ab9be5 Compare August 1, 2025 00:45
@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci Bot commented Aug 1, 2025

Upstream branch: f2d282e
series: https://patchwork.kernel.org/project/linux-block/list/?series=987357
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/987357=>linus-master branch from c42ed1c to 3d9c7c9 Compare August 1, 2025 00:51
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from 8ab9be5 to 5b90760 Compare August 1, 2025 04:53
@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci Bot commented Aug 1, 2025

Upstream branch: 89748ac
series: https://patchwork.kernel.org/project/linux-block/list/?series=987357
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/987357=>linus-master branch from 3d9c7c9 to 73e93c4 Compare August 1, 2025 04:59
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch 2 times, most recently from 3893da1 to aeddbbb Compare August 1, 2025 12:14
@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci Bot commented Aug 1, 2025

Upstream branch: 89748ac
series: https://patchwork.kernel.org/project/linux-block/list/?series=987357
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/987357=>linus-master branch from 73e93c4 to 442e992 Compare August 1, 2025 12:20
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from aeddbbb to f380900 Compare August 1, 2025 12:39
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from 1356209 to ae9bce3 Compare August 9, 2025 06:21
@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci Bot commented Aug 9, 2025

Upstream branch: c30a135
series: https://patchwork.kernel.org/project/linux-block/list/?series=987357
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/987357=>linus-master branch from e5b55fa to 95411ad Compare August 9, 2025 06:30
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from ae9bce3 to e263d6e Compare August 9, 2025 15:26
@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci Bot commented Aug 9, 2025

Upstream branch: 561c803
series: https://patchwork.kernel.org/project/linux-block/list/?series=987357
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/987357=>linus-master branch from 95411ad to 769d1c2 Compare August 9, 2025 15:35
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from e263d6e to 77110f5 Compare August 10, 2025 05:58
@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci Bot commented Aug 10, 2025

Upstream branch: b96ddbc
series: https://patchwork.kernel.org/project/linux-block/list/?series=987357
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/987357=>linus-master branch from 769d1c2 to 79cf465 Compare August 10, 2025 06:08
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from 77110f5 to a2e0474 Compare August 10, 2025 06:39
@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci Bot commented Aug 10, 2025

Upstream branch: 2b38afc
series: https://patchwork.kernel.org/project/linux-block/list/?series=987357
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/987357=>linus-master branch from 79cf465 to e10ed8d Compare August 10, 2025 06:49
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from a2e0474 to 36a8aec Compare August 10, 2025 16:54
@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci Bot commented Aug 10, 2025

Upstream branch: 8f5ae30
series: https://patchwork.kernel.org/project/linux-block/list/?series=987357
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/987357=>linus-master branch from e10ed8d to 9ab0aae Compare August 10, 2025 17:04
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from 36a8aec to 1a46df6 Compare August 12, 2025 04:07
@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci Bot commented Aug 12, 2025

Upstream branch: 53e760d
series: https://patchwork.kernel.org/project/linux-block/list/?series=987357
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/987357=>linus-master branch from 9ab0aae to 33c54ed Compare August 12, 2025 04:18
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from 1a46df6 to 404c2ca Compare August 12, 2025 16:09
@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci Bot commented Aug 12, 2025

Upstream branch: 0e39a73
series: https://patchwork.kernel.org/project/linux-block/list/?series=987357
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/987357=>linus-master branch from 33c54ed to c1ffc66 Compare August 12, 2025 16:20
@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci Bot commented Aug 12, 2025

Upstream branch: 8742b2d
series: https://patchwork.kernel.org/project/linux-block/list/?series=987357
version: 1

@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci Bot commented Aug 13, 2025

Upstream branch: 91325f3
series: https://patchwork.kernel.org/project/linux-block/list/?series=987357
version: 1

@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci Bot commented Aug 13, 2025

Upstream branch: 3a4a036
series: https://patchwork.kernel.org/project/linux-block/list/?series=987357
version: 1

@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci Bot commented Aug 13, 2025

Upstream branch: dfc0f63
series: https://patchwork.kernel.org/project/linux-block/list/?series=987357
version: 1

@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci Bot commented Aug 14, 2025

Upstream branch: 0cc5352
series: https://patchwork.kernel.org/project/linux-block/list/?series=987357
version: 1

@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci Bot commented Aug 14, 2025

Upstream branch: 24ea63e
series: https://patchwork.kernel.org/project/linux-block/list/?series=987357
version: 1

@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci Bot commented Aug 15, 2025

Upstream branch: d7ee5bd
series: https://patchwork.kernel.org/project/linux-block/list/?series=987357
version: 1

Recently, we encountered the following hungtask:

INFO: task kworker/11:2:2981147 blocked for more than 6266 seconds
"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
kworker/11:2    D    0 2981147      2 0x80004000
Workqueue: cgroup_destroy css_free_rwork_fn
Call Trace:
 __schedule+0x934/0xe10
 schedule+0x40/0xb0
 wb_wait_for_completion+0x52/0x80
 ? finish_wait+0x80/0x80
 mem_cgroup_css_free+0x3a/0x1b0
 css_free_rwork_fn+0x42/0x380
 process_one_work+0x1a2/0x360
 worker_thread+0x30/0x390
 ? create_worker+0x1a0/0x1a0
 kthread+0x110/0x130
 ? __kthread_cancel_work+0x40/0x40
 ret_from_fork+0x1f/0x30

This is because the writeback thread has been continuously and repeatedly
throttled by wbt, but at the same time, the writes of another thread
proceed quite smoothly.
After debugging, I believe it is caused by the following reasons.

When thread A is blocked by wbt, the I/O issued by thread B will
use a deeper queue depth(rwb->rq_depth.max_depth) because it
meets the conditions of wb_recent_wait(), thus allowing thread B's
I/O to be issued smoothly and resulting in the inflight I/O of wbt
remaining relatively high.

However, when I/O completes, due to the high inflight I/O of wbt,
the condition "limit - inflight >= rwb->wb_background / 2"
in wbt_rqw_done() cannot be satisfied, causing thread A's I/O
to remain unable to be woken up.

Some on-site information:

>>> rwb.rq_depth.max_depth
(unsigned int)48
>>> rqw.inflight.counter.value_()
44
>>> rqw.inflight.counter.value_()
35
>>> prog['jiffies'] - rwb.rqos.q.backing_dev_info.last_bdp_sleep
(unsigned long)3
>>> prog['jiffies'] - rwb.rqos.q.backing_dev_info.last_bdp_sleep
(unsigned long)2
>>> prog['jiffies'] - rwb.rqos.q.backing_dev_info.last_bdp_sleep
(unsigned long)20
>>> prog['jiffies'] - rwb.rqos.q.backing_dev_info.last_bdp_sleep
(unsigned long)12

cat wb_normal
24
cat wb_background
12

To fix this issue, we can use max_depth in wbt_rqw_done(), so that
the handling of wb_recent_wait by wbt_rqw_done() and get_limit()
will also be consistent, which is more reasonable.

Signed-off-by: Julian Sun <[email protected]>
Fixes: e34cbd3 ("blk-wbt: add general throttling mechanism")
@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci Bot commented Aug 20, 2025

Upstream branch: b19a97d
series: https://patchwork.kernel.org/project/linux-block/list/?series=987357
version: 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants